package cn.qn.repository.member;

import cn.qn.moudle.security.MemberRole;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author: Bryant
 * @date: 2019/5/26
 * @description:
 */
@Repository
public interface MemberRoleRepository extends JpaRepository<MemberRole, Integer> {

    List<MemberRole> findMemberRolesByUserId(String userId);

    @Query(value = "select role_id from security_member_role  where user_id=?1",nativeQuery=true)
    List<Integer> findRoleIdsByUserId(String userId);
}
